Repository navigation
Add wasm_esm_integration_builtins compat flag for runtime-compiled Wasm - #7685
Merged
Merged
Conversation
Contributor
|
Since last review: 0 resolved, 0 still open, 0 new. Not re-run: tests, api-compat, docs, compat-flags, design-simplicity, jsg-gc, kj-style, memory-safety (no author changes in their files since the last review) Specialist findings not posted (1)
Reviewed commit: ca2394cd · github run |
guybedford
force-pushed
the
gbedford/wasm-js-string-builtins
branch
2 times, most recently
from
October 12, 2026 16:09
b25c284 to
1a27ec9
Compare
jasnell
approved these changes
Oct 12, 2026
Compile Wasm modules with the js-string builtins and imported string
constants enabled, equivalent to the JS options
`{ builtins: ['js-string'], importedStringConstants: 'wasm:js/string-constants' }`.
These are strictly per-module opt-in in V8 with no global flag, so pass
them via WasmModuleObject::CompileOptions in jsg::compileWasmModule, which
covers all runtime-compiled Wasm: ESM import / import source in both module
registries, and the deprecated Service Worker syntax wasmModule binding.
A WebAssembly.Module passed to the worker loader carries compiled code that
bakes in the compile-time imports of the isolate that compiled it. Record
the parent's mode alongside the compiled module and recompile from the wire
bytes when the child's setting differs, in either direction, so loader-
provided modules respect the child's flag.
The proposal is still in the implementation phase, so this is gated behind
the opt-in wasm_esm_integration_builtins compat flag with no enable date.
guybedford
force-pushed
the
gbedford/wasm-js-string-builtins
branch
from
October 12, 2026 19:25
1a27ec9 to
ca2394c
Compare
guybedford
enabled auto-merge (squash)
October 12, 2026 19:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
wasm_esm_integration_builtinscompatibility flag that compiles Wasm modules with the js-string builtins and imported string constants enabled, resolves #6811. Equivalent to the JS-visible options:V8 has no global flag for these; they are strictly per-module opt-in, so workerd-compiled modules (which never go through the JS constructor) couldn't use them. V8 now exposes
WasmModuleObject::CompilewithCompileOptions, so when the flag is setjsg::compileWasmModulepasses:Since this is the single shared compile helper, it covers all runtime-compiled Wasm:
import/import sourcein both module registries, and the deprecated Service Worker syntaxwasmModulebinding. The flag is plumbed throughIsolateBaselike the other module-related compat flags.The js-string-builtins proposal is still in the implementation phase, so the flag is opt-in with no enable date.
Test coverage: adds a
js-string-builtins.watfixture importing the js-stringlengthbuiltin and a"hello world"string constant, which only links if both features are enabled.new-module-registry-test(flag on) assertsconstantLength()returns11across normal import, staticimport source, and dynamicimport.source(), using query-distinct specifiers so each path gets its own compile.wasm-js-string-builtins-test(flag off, legacy registry) asserts thewasm:js-stringimport is treated as an ordinary unsupplied import.